{template 'common/header'}
<ul class="nav nav-tabs">
    <li {if $op=='list' } class="active" {/if}>
        <a href="{php echo $this->createWebUrl('order', array('op' => 'list'));}">订单列表</a>
    </li>
	{if $op=='detail' }
	<li {if $op=='detail' } class="active" {/if}>
        <a href="{php echo $this->createWebUrl('order', array('op' => 'list'));}">订单佣金分配明细</a>
    </li>
	{/if}
</ul>
{if $op=='list'}
<div class="panel panel-info">
        <div class="panel-heading">更新订单</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form2">
				<div class="form-group">
					<label class="col-xs-12 col-sm-1 control-label" style="width: 6%;">更新时间：</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
						{php echo tpl_form_field_date('order_time',$order_time, $withtime = false);}
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">选择平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 13%;">
					    <input type="hidden" name="c" value="site" />
						<input type="hidden" name="a" value="entry" />
						<input type="hidden" name="m" value="{php echo $this->modulename}" />
						<input type="hidden" name="do" value="get_order" />
                        <select name="pt1" id="sid" class="form-control">
						    <option value="" {if !$_GPC['pt1']}selected="selected"{/if}></option>
							<option value="8" {if $_GPC['pt1']=='8'}selected="selected"{/if}>聚推客联盟</option>
                            <option value="3" {if $_GPC['pt1']=='3'}selected="selected"{/if}>美团联盟（官方）</option>
							<option value="2" {if $_GPC['pt1']=='2'}selected="selected"{/if}>美团分销联盟（官方）</option>
                            <option value="4" {if $_GPC['pt1']=='4'}selected="selected"{/if}>淘宝联盟（含饿了么）</option>
							<option value="5" {if $_GPC['pt1']=='5'}selected="selected"{/if}>京东</option>
							<option value="6" {if $_GPC['pt1']=='6'}selected="selected"{/if}>拼多多</option>
							<option value="7" {if $_GPC['pt1']=='7'}selected="selected"{/if}>唯品会</option>
							<option value="1" {if $_GPC['pt1']=='1'}selected="selected"{/if}>订单侠</option>
                        </select>
                    </div>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label" id="sid_1" style="width: 5%;display:none;">折淘客sid：</label>
					<div class="col-sm-2 col-xs-12" id="sid_2" style="width: 8%;display:none;">
						<input type="text" name="sid" class="form-control" value="{$settings['sid']}" />
						<span class="help-block" style="color:red;">*默认为淘宝api参数的sid，其他sid请自行修改</span>
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 10%;display:none;" id="sid_3">普通订单/渠道订单</label>
					<div class="col-sm-2 col-xs-12" style="width: 8%;display:none;" id="sid_4">
                        <select name="order_scene" id="sid" class="form-control">
						    <option value="" {if !$_GPC['order_scene']}selected="selected"{/if}></option>
							<option value="1" {if $_GPC['order_scene']=='1'}selected="selected"{/if}>普通订单</option>
                            <option value="2" {if $_GPC['order_scene']=='2'}selected="selected"{/if}>渠道订单</option>
                        </select>
                    </div>
					<div class="col-md-4 mathyts">
						<button type="submit" class="btn btn-primary"><i class="fa fa-refresh"></i>更新订单</button>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading">发放佣金</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form3">
				<div class="form-group">
				    <label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">选择平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
					    <input type="hidden" name="c" value="site" />
						<input type="hidden" name="a" value="entry" />
						<input type="hidden" name="m" value="{php echo $this->modulename}" />
						<input type="hidden" name="do" value="settlement_order" />
                        <select name="pingtai1" class="form-control" id="pingtai11">
						    <option value="" {if !$_GPC['pingtai1']}selected="selected"{/if}></option>
							<option value="美团外卖" {if $_GPC['pingtai1']=='美团外卖'}selected="selected"{/if}>美团外卖</option>
							<option value="美团闪购" {if $_GPC['pingtai1']=='美团闪购'}selected="selected"{/if}>美团闪购</option>
							<option value="美团团购" {if $_GPC['pingtai1']=='美团团购'}selected="selected"{/if}>美团团购</option>
							<option value="美团酒店" {if $_GPC['pingtai1']=='美团酒店'}selected="selected"{/if}>美团酒店</option>
							<option value="美团优选" {if $_GPC['pingtai1']=='美团优选'}selected="selected"{/if}>美团优选</option>
							<option value="饿了么" {if $_GPC['pingtai1']=='饿了么'}selected="selected"{/if}>饿了么</option>
							<option value="电影票" {if $_GPC['pingtai1']=='电影票'}selected="selected"{/if}>电影票</option>
							<option value="肯德基" {if $_GPC['pingtai1']=='肯德基'}selected="selected"{/if}>肯德基</option>
							<option value="麦当劳" {if $_GPC['pingtai1']=='麦当劳'}selected="selected"{/if}>麦当劳</option>
							<option value="京东" {if $_GPC['pingtai1']=='京东'}selected="selected"{/if}>京东</option>
							<option value="拼多多" {if $_GPC['pingtai1']=='拼多多'}selected="selected"{/if}>拼多多</option>
							<option value="唯品会" {if $_GPC['pingtai1']=='唯品会'}selected="selected"{/if}>唯品会</option>
							<option value="淘宝" {if $_GPC['pingtai1']=='淘宝'}selected="selected"{/if}>淘宝</option>
							<option value="天猫" {if $_GPC['pingtai1']=='天猫'}selected="selected"{/if}>天猫</option>
							<option value="其他" {if $_GPC['pingtai1']=='其他'}selected="selected"{/if}>其他</option>
                        </select>
                    </div>
					<div class="col-md-4 mathyts">
						<button type="submit" class="btn btn-primary"><i class="fa fa-refresh"></i>发放佣金</button>
						<span class="help-block" style="color:red;">*请根据各个平台结算规则手动发放佣金给用户；</span>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{php echo $this->modulename}" />
				<input type="hidden" name="do" value="order" />
				

                
				<div class="form-group">
				    
					<label class="col-xs-12 col-sm-1 control-label" style="width: 6%;">订单付款日期</label>
					<div class="col-sm-2 col-xs-12" style="width: 15%;">{php echo tpl_form_field_daterange('daterange', $daterange)}</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 4%;">订单号</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
						<input class="form-control" name="keyword2" id="" type="text" value="{$_GPC['keyword2']}" placeholder="根据订单号搜索">
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 2%;">平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">

                        <select name="keyword1" class="form-control" id="pingtai1">

						    <option value="" >全部</option>

							<option value="jutuike" {if $_GPC['keyword1']=='jutuike'}selected="selected"{/if}>聚推客联盟</option>

                           <option value="meituan" {if $_GPC['keyword1']=='meituan'}selected="selected"{/if}>美团联盟</option>

							 <option value="fenxiao" {if $_GPC['keyword1']=='fenxiao'}selected="selected"{/if}>美团分销联盟</option>

                            <option value="elm" {if $_GPC['keyword1']=='elm'}selected="selected"{/if}>饿了么</option>

							<option value="movie" {if $_GPC['keyword1']=='movie'}selected="selected"{/if}>电影票</option>

							<option value="jd" {if $_GPC['keyword1']=='jd'}selected="selected"{/if}>京东</option>

							<option value="pdd" {if $_GPC['keyword1']=='pdd'}selected="selected"{/if}>拼多多</option>

							<option value="wph" {if $_GPC['keyword1']=='wph'}selected="selected"{/if}>唯品会</option>

							<option value="tb" {if $_GPC['keyword1']=='tb'}selected="selected"{/if}>淘宝联盟</option>

							

                        </select>

                    </div>
					<label class="col-xs-12 col-sm-1 control-label" id="pingtai2_1" style="width: 5%;">选择类型</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;" id="pingtai2_2">
                        <select name="pingtai2" class="form-control">
						    <option value="" {if !$_GPC['pingtai2']}selected="selected"{/if}>全部</option>
                            <option value="美团外卖" {if $_GPC['pingtai2']=='美团外卖'}selected="selected"{/if}>美团外卖</option>
							<option value="美团闪购" {if $_GPC['pingtai2']=='美团闪购'}selected="selected"{/if}>美团闪购</option>
							<option value="美团团购" {if $_GPC['pingtai2']=='美团团购'}selected="selected"{/if}>美团团购</option>
							<option value="美团酒店" {if $_GPC['pingtai2']=='美团酒店'}selected="selected"{/if}>美团酒店</option>
							<option value="美团优选" {if $_GPC['pingtai2']=='美团优选'}selected="selected"{/if}>美团优选</option>
							<option value="饿了么" {if $_GPC['pingtai2']=='饿了么'}selected="selected"{/if}>饿了么</option>
							<option value="电影票" {if $_GPC['pingtai2']=='电影票'}selected="selected"{/if}>电影票</option>
							<option value="肯德基" {if $_GPC['pingtai2']=='肯德基'}selected="selected"{/if}>肯德基</option>
							<option value="麦当劳" {if $_GPC['pingtai2']=='麦当劳'}selected="selected"{/if}>麦当劳</option>
							<option value="京东" {if $_GPC['pingtai2']=='京东'}selected="selected"{/if}>京东</option>
							<option value="拼多多" {if $_GPC['pingtai2']=='拼多多'}selected="selected"{/if}>拼多多</option>
							<option value="唯品会" {if $_GPC['pingtai2']=='唯品会'}selected="selected"{/if}>唯品会</option>
							<option value="淘宝" {if $_GPC['pingtai2']=='淘宝'}selected="selected"{/if}>淘宝</option>
							<option value="天猫" {if $_GPC['pingtai2']=='天猫'}selected="selected"{/if}>天猫</option>
							<option value="其他" {if $_GPC['pingtai2']=='其他'}selected="selected"{/if}>其他</option>
                        </select>
                    </div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">订单状态</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">

                        <select name="keyword3" class="form-control">

						    <option value="" >全部</option>

                            <option value="1" {if $_GPC['keyword3']=='1'}selected="selected"{/if}>已付款</option>

							<option value="2" {if $_GPC['keyword3']=='2'}selected="selected"{/if}>平台已结算</option>

                            <option value="3" {if $_GPC['keyword3']=='3'}selected="selected"{/if}>已发放给用户</option>

							<option value="4" {if $_GPC['keyword3']=='4'}selected="selected"{/if}>已付款+已结算</option>

							<option value="5" {if $_GPC['keyword3']=='5'}selected="selected"{/if}>已取消</option>

                        </select>

                    </div>
					<div>
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<button type="button" class="btn btn-default">总记录数：{$total}</button>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading" style="color: #000000;background-color: #ffca81;border-color: #f98000;">数据统计</div>
		<div class="panel-body">
		    <div class="col-sm-5" style="width: 100%;">
			    <label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">总佣金收益：<b style="color:red;">{php echo round($allyjsql['order_profit1'],2)}</b></label>
				<label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">已分配佣金：<b style="color:red;">{php echo round($allfxyjsql['c_11']+$allfxyjsql['c_21']+$allfxyjsql['c_31']+$allfxyjsql['c_t1']+$allfxyjsql['c_2t1']+$allfxyjsql['c_1h1']+$allfxyjsql['c_2h1']+$allfxyjsql['c_3h1']+$allfxyjsql['c_4h1'],2)}</b></label>
				<label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">结余佣金收益：<b style="color:red;">{php echo round($allyjsql['order_profit1']-($allfxyjsql['c_11']+$allfxyjsql['c_21']+$allfxyjsql['c_31']+$allfxyjsql['c_t1']+$allfxyjsql['c_2t1']+$allfxyjsql['c_1h1']+$allfxyjsql['c_2h1']+$allfxyjsql['c_3h1']+$allfxyjsql['c_4h1']),2)}</b></label>
			</div>
		</div>
</div>
<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
    <div style="padding:15px;">
        <table class="table table-hover table-condensed">
            <thead class="navbar-inner">
                <tr>
                    <tr>

                    <th>id</th>

                    <th>平台</th>

					<th>类型</th>

                    <th>状态</th>

					<th>用户</th>

					<th>用户UID</th>

					<th>订单号</th>

					 <th>订单金额</th>

					 <th>订单佣金</th>

					 <th>已分配佣金</th>

					 <th>结余佣金</th>

                    <th>商品名</th>

                    <th>付款时间</th>

					<th style="text-align:right;">操作</th>

                </tr>
            </thead>
                <tbody id="level-list">

                {loop $list $item}
                <tr>

                    <td>{$item['id']}</td>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}

					

					

					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
					       if(!$item['c_1_uid']){$item['c_1_uid'] = $item['c1_uid'];}
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1_uid'],'system_id' => $settings['system_id']));
					   }else{
					       if(!$item['c_1_uid']){$item['c_1_uid'] = $item['c1_uid'];}
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>

                        <img style="width: 40px;" src="{$user['avatar']}">

                        {$user['nickname']}

                    </td>

					<td>{$user['uid']}</td>

					<td>{$item['order_id']}</td>

					<td>￥{$item['order_price']}</td>

					<td>￥{$item['order_profit']}</td>

					<td>￥{php echo round($item['c_1']+$item['c_2']+$item['c_3']+$item['c_t']+$item['c_h']+$item['c_2t']+$item['c_1h']+$item['c_2h']+$item['c_4h']+$item['c_3h'],2)}</td>

					<td>￥{php echo round($item['order_profit']-$item['c_1']-$item['c_2']-$item['c_3']-$item['c_t']-$item['c_h']-$item['c_2t']-$item['c_1h']-$item['c_2h']-$item['c_4h']-$item['c_3h'],2)}</td>

					<td>{$item['goods_title']}</td>

					<td><div class="type-parent">{if $item['order_status'] == 1 || $item['order_status'] == 3 || $item['order_status'] == 8 || $item['order_status'] == 12 || $item['order_status'] == 14 || $item['order_status'] == 16 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 101 || $item['order_status'] == 102 || $item['order_status'] == 103}{php echo date('Y-m-d H:i:s',$item['order_paid_time'])}{/if}</div></td>

					<td style="text-align:right;">
					    <a class="btn btn-primary btn-xs" href="{php echo $this->createWebUrl('order',array('op'=>detail,'id'=>$item['id']))}">佣金明细</a>
                        <a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('order',array('op'=>del,'id'=>$item['id']))}"     onclick="return confirm('确认删除此订单吗？');return false;" title="删除">删除</a>

                    </td>


                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</form>
<script>
$('#pingtai1').change(function(){
    var data= $(this).val();
    if(data == 'jutuike'){
		$("#pingtai2_1").show();
		$("#pingtai2_2").show();
	}else{
		$("#pingtai2_1").hide();
		$("#pingtai2_2").hide();
	}
});
$('#sid').change(function(){
    var data= $(this).val();
    if(data == 4){
		$("#sid_1").show();
		$("#sid_2").show();
		$("#sid_3").show();
		$("#sid_4").show();
	}else{
		$("#sid_1").hide();
		$("#sid_2").hide();
		$("#sid_3").hide();
		$("#sid_4").hide();
	}
});
</script>
{elseif $op=='detail'}
<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
    <div style="padding:15px;">
        <table class="table table-hover table-condensed">
            <thead class="navbar-inner">
                <tr>
                    <tr>

                    <th>平台</th>

					<th>类型</th>

                    <th>状态</th>

					<th>用户</th>

					<th>用户UID</th>

					<th>订单号</th>

					 <th>订单金额</th>

					 <th>订单佣金</th>

					 <th>分配佣金</th>

					 <th>佣金级别</th>

                </tr>
            </thead>
                <tbody id="level-list">

                {if $item['c_1'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_1']}</td>
					<td>自购/自推</td>
                </tr>
                {/if}
				{if $item['c_2'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_2']}</td>
					<td>普通会员直推</td>
                </tr>
                {/if}
				{if $item['c_3'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_3_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_3_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_3']}</td>
					<td>普通会员间推</td>
                </tr>
                {/if}
				{if $item['c_t'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_t_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_t_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_t']}</td>
					<td>团长/合伙人间推</td>
                </tr>
                {/if}
				{if $item['c_2t'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2t_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2t_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_2t']}</td>
					<td>团长间属团长</td>
                </tr>
                {/if}
				{if $item['c_1h'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_1h']}</td>
					<td>合伙人直属团长</td>
                </tr>
                {/if}
				{if $item['c_2h'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_2h']}</td>
					<td>合伙人间属团长</td>
                </tr>
                {/if}
				{if $item['c_3h'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_3h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_3h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_3h']}</td>
					<td>合伙人直属合伙人</td>
                </tr>
                {/if}
				{if $item['c_4h'] > 0}
                <tr>
					<td>{if $item['pingtai'] == 'meituan'}美团联盟{elseif $item['pingtai'] == 'elm'}饿了么{elseif $item['pingtai'] == 'fenxiao'}美团分销联盟{elseif $item['pingtai'] == 'movie'}电影票{elseif $item['pingtai'] == 'jd'}京东{elseif $item['pingtai'] == 'pdd'}拼多多{elseif $item['pingtai'] == 'wph'}唯品会{elseif $item['pingtai'] == 'tb'}淘宝联盟{elseif $item['pingtai'] == 'jutuike'}聚推客联盟{/if}</td>

					<td>{$item['pingtai_name']}</td>

					{if $item['order_settlement_time'] > 0}

					<td>已发放</td>

					{else}

					<td>{if $item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103}已完成{/if}{if $item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101}已付款{/if}{if $item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104}已取消{/if}</td>

					{/if}
					<td>
					<?php
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_4h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_4h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="{$user['avatar']}">{$user['nickname']}
                    </td>
					<td>{$user['uid']}</td>
					<td>{$item['order_id']}</td>
					<td>￥{$item['order_price']}</td>
					<td>￥{$item['order_profit']}</td>
					<td>￥{$item['c_4h']}</td>
					<td>合伙人间属合伙人</td>
                </tr>
                {/if}
            </tbody>
        </table>
        {$pager}
    </div>
</form>
{/if}

{template 'common/footer'}
